package top.timous.service.Impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.timous.mapper.ProvinceMapper;
import top.timous.pojo.ProvinceInfo;
import top.timous.service.ProvinceService;

import java.util.*;

@Service
public class ProvinceServiceImpl implements ProvinceService {

    @Autowired
    private ProvinceMapper provinceMapper;
    @Override
    public Map<String, Object> noDataProvinceList(String date) {

        String[] s = date.split("-");
        for (String s1 : s) {
            System.out.println(s1);
        }
        int year = Integer.parseInt(s[0]);
        int month = Integer.parseInt(s[1]);
        int day = Integer.parseInt(s[2]);
        List<ProvinceInfo> ProvinceInfos = provinceMapper.noDataProvinceList(year, month, day);
        Map<String , Object> map = new HashMap<String, Object>();
        map.put("data" , ProvinceInfos);   //  请求的数据
        map.put("msg" , "请求成功!!!");   //  响应的信息
        map.put("code" , 0);  // 请求成功的响应码     0   表示请求成功     -1 表示请求失败   - 2 表示没有权限

        return map;
    }
}
